package org.edu.modules.kaoqin.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.edu.modules.kaoqin.dto.VeHrPerformanceDTO;
import org.edu.modules.kaoqin.entity.VeHrPerformance;

public interface VeHrPerformanceMapper extends BaseMapper<VeHrPerformance> {

    @Select("<script> " +
            "select vhp.*,vbt.XM as xm ,vbd.JGMC as departName " +
            "from ve_hr_performance as vhp " +
            "left join ve_base_teacher vbt on vhp.userId = vbt.userId " +
            "left join ve_base_department vbd on vbt.depId = vbd.id " +
            "where  1 " +
            "   <if test=\"performanceDTO.xm != null and performanceDTO.xm !=''\">" +
            "  and vbt.XM like #{performanceDTO.xm}  " +
            "   </if>" +
            "   <if test=\"performanceDTO.departId != null \">" +
            "  and vbt.depId=#{performanceDTO.departId}  " +
            "   </if>" +
            "   <if test='performanceDTO.startTime != null and performanceDTO.endTime != null'>" +
            "  and vhp.KQRQ between #{performanceDTO.startTime} and #{performanceDTO.endTime}" +
            "   </if >" +
            "</script>")
    Page<VeHrPerformanceDTO> listByCondition(Page<VeHrPerformanceDTO> page, @Param("performanceDTO") VeHrPerformanceDTO performanceDTO);
}
